﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using Xant.FlowEngine.Core;

namespace Xant.FlowEngine
{
    public class DataModelInitializer : DropCreateDatabaseIfModelChanges<DataModelContext> // CreateDatabaseIfNotExists<DataModelContext>
    {
        protected override void Seed(DataModelContext context)
        {
            var processes = new List<MainProcess>
            {
                new MainProcess{ Name = "测试流程 at "+DateTime.Now.ToString()},
            };
            context.Processes.AddRange(processes);
            context.SaveChanges();

            /*var receipts = new List<Receipt>
            {
                new Receipt{ReceiptId=Guid.NewGuid(), Corporation=corporations.First(), ReceiptNo="CIL201400295", DateOfReceipt=new DateTime(2014, 11,19), Customer="Lockton Companies(HK) Limited", AmountOfMoney=258406.15m, PaymentOf="DN-14-00551", BankName="BOC", ChequeNo="041659", ChequeDate=new DateTime(2014,11,13), CreateTime=DateTime.Now, CreatorAccount=@"COHL\XZC", CreatorName="xuzicheng"},
                new Receipt{ReceiptId=Guid.NewGuid(), Corporation=corporations.Skip(1).First(),ReceiptNo="CZJ201400001", DateOfReceipt=new DateTime(2014, 10, 10), Customer="Drip Studio of China", AmountOfMoney=123456.78m, PaymentOf="TEST-08978", BankName="BOC", ChequeNo="141205", ChequeDate=new DateTime(2014,10,20), CreateTime=DateTime.Now, CreatorAccount=@"COHL\XZC", CreatorName="xuzicheng"},
            };
            receipts.ForEach(c => context.Receipts.Add(c));
            context.SaveChanges();*/
        }

    }

}